package com.ruoyi.life.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.life.mapper.ZsCustomerFollowMapper;
import com.ruoyi.life.domain.ZsCustomerFollow;
import com.ruoyi.life.service.IZsCustomerFollowService;

/**
 * 客户跟进Service业务层处理
 *
 * @author cjie
 * @date 2021-08-03
 */
@Service
public class ZsCustomerFollowServiceImpl implements IZsCustomerFollowService {
    @Autowired
    private ZsCustomerFollowMapper zsCustomerFollowMapper;

    /**
     * 查询客户跟进
     *
     * @param id 客户跟进ID
     * @return 客户跟进
     */
    @Override
    public ZsCustomerFollow selectZsCustomerFollowById(String id) {
        return zsCustomerFollowMapper.selectZsCustomerFollowById(id);
    }

    /**
     * 查询客户跟进列表
     *
     * @param zsCustomerFollow 客户跟进
     * @return 客户跟进
     */
    @Override
    public List<ZsCustomerFollow> selectZsCustomerFollowList(ZsCustomerFollow zsCustomerFollow) {
        return zsCustomerFollowMapper.selectZsCustomerFollowList(zsCustomerFollow);
    }

    /**
     * 新增客户跟进
     *
     * @param zsCustomerFollow 客户跟进
     * @return 结果
     */
    @Override
    public int insertZsCustomerFollow(ZsCustomerFollow zsCustomerFollow) {
        zsCustomerFollow.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        zsCustomerFollow.setCreateTime(DateUtils.getNowDate());
        zsCustomerFollow.setCreateBy(SecurityUtils.getUsername());
        return zsCustomerFollowMapper.insertZsCustomerFollow(zsCustomerFollow);
    }

    /**
     * 修改客户跟进
     *
     * @param zsCustomerFollow 客户跟进
     * @return 结果
     */
    @Override
    public int updateZsCustomerFollow(ZsCustomerFollow zsCustomerFollow) {
        zsCustomerFollow.setUpdateTime(DateUtils.getNowDate());
        zsCustomerFollow.setUpdateBy(SecurityUtils.getUsername());
        return zsCustomerFollowMapper.updateZsCustomerFollow(zsCustomerFollow);
    }

    /**
     * 批量删除客户跟进
     *
     * @param ids 需要删除的客户跟进ID
     * @return 结果
     */
    @Override
    public int deleteZsCustomerFollowByIds(String[] ids) {
        return zsCustomerFollowMapper.deleteZsCustomerFollowByIds(ids);
    }

    /**
     * 删除客户跟进信息
     *
     * @param id 客户跟进ID
     * @return 结果
     */
    @Override
    public int deleteZsCustomerFollowById(String id) {
        return zsCustomerFollowMapper.deleteZsCustomerFollowById(id);
    }
}
